{include file="public/header" /}
<!--main content start-->
<section class="main-content-wrapper">
    <section id="main-content">
        <div class="row">
    <div class="col-md-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">单页列表</h3>
            </div>
            <div class="panel-body">
                <div class="table-responsive">
                    <table class="table table-bordered ">
                        <thead>
                        <tr>
                            <th>#</th>
                            <th>文章标题</th>
                            <th>阅读数</th>
                            <th>发布/修改时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {volist name="lists" id="vo"}
                        <tr class="bg_focuse">
                            <td><input class="" type="checkbox" name="checkbox">{$vo.id}</td>
                            <td>{$vo.title}</td>
                            <td>{$vo.read_num}</td>
                            <td>{$vo.add_time|date="Y-m-d H:i",###}</td>
                            <td><button type="button" class="btn btn-xs btn-default" onclick="operation('detail',{$vo.id})">修改</button> &nbsp; <button type="button" class="btn btn-xs btn-default" data-toggle="modal" data-target="#delete" onclick="operation('delete',{$vo.id})" >删除</button></td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                </div>
                {$lists->render()}
            </div>
        </div>
    </div>
</div>
    </section>
</section>
<style>
    .table-striped>tbody>tr:nth-child(odd)>td:hover{
         background-color: #fff;
    }
    .bg_focuse:hover td{background-color: #dff0d8;}

</style>
<script language="javascript" type="text/javascript">
    function operation(type,id){
        if(type=='delete'){
            if(confirm("确定删除?")) {
                del(id);
            }
        }
        if(type=='detail'){
            window.location.href="/admin/page/detail?id="+id;
        }
    }
    function del(id){
        $.ajax({
            type: "GET",  //提交方式
            url: "/admin/Page/page_delete",//路径
            data: 'id='+id,
            dataType: "json",
            success: function (data) {
                if(data.status==0){
                    location.reload();
                }else{
                    alert('系统错误!');
                }
            }
        });
    }
</script>
<!--main content end-->
{include file="public/footer" /}